package facelets.www;
 
import java.io.Serializable;
import java.util.Locale;

import javax.enterprise.context.SessionScoped;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.inject.Named;

@Named
@SessionScoped
public class Idioma implements Serializable { 
	
	public String ptBR(){
		return trocar("pt_BR");
	}
	
	public String en(){
		return trocar("en");
	}
	
	private String trocar(String idioma) {
		UIViewRoot vr = FacesContext.getCurrentInstance().getViewRoot();
		vr.setLocale(new Locale(idioma));
		return null; 
	}
}